#ifndef VVIEWMANAGER_H
#define VVIEWMANAGER_H

#include <QtCore/QMap>
#include <QtCore/QList>

class QMenu;
class QAction;
class QStackedWidget;

class VAbstractView;

class VViewManager : public QObject
{
	Q_OBJECT

public:
	VViewManager(QMenu* modeMenu, QWidget *parent);
	~VViewManager();

public:
	VAbstractView* activeView() const;	
	VAbstractView* findView(const QString& name) const;
	void setActiveView(const QString& name);

public slots:
	void registerView(VAbstractView* view);
	void unregisterView(VAbstractView* view);

	void activateAction(QAction* a);

private:
	VAbstractView* m_curView;
	typedef QList<QPointer<VAbstractView> > VViews;	
	VViews m_views;

	QMenu* m_modeMenu;
	QStackedWidget* m_stackWidget;

	typedef QMap<VAbstractView*, QList<QAction*> > VViewActions;
	VViewActions m_actions;

	typedef QMap<VAbstractView*, QAction*> VModeActions;
	VModeActions m_modeActions;
};

#endif // VVIEWMANAGER_H
